home *** CD-ROM | disk | FTP | other *** search
- /***************************************************************
-
- Sample.c
-
- Written by Jefferson Quade
- ©1993-1994 Quade Publishing Company, Box 1574, Fort Dodge, Iowa 50501
-
- Created Sunday, August 8, 1993 04:40 PM
-
- ***************************************************************/
-
- /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
- Include files.
- >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
-
- #ifndef _H_MacHeaders
- #include <MacHeaders>
- #endif
-
- #include <QLibrary.h>
- #include "Chess.h"
-
- /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
- Private prototypes.
- >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
-
- static void ChessUtilitiesRoutines (void);
-
- /*=========================================================================
-
- =========================================================================*/
-
- static void ChessUtilitiesRoutines (void)
- {
- //• Declared static with no arguments, save the 6 bytes on the stack frame.
- asm
- {
- /*=========================================================================
- Returns true if the game square is white.
- =========================================================================*/
-
- //• Object size 24 bytes.
- extern SquareIsWhite: ; Assembly language is small and fast!
- move.w 4(sp), d1 // Square number.
- subq.w #1, d1 // Shift numbers down one.
- btst #0, d1 // See if even or odd number.
- sne d0 // If odd number then white square.
- btst #3, d1 // See if even or odd column.
- beq.s @1 // If odd column return.
- tst.b d0
- seq d0 // Toggle result.
- @1: return
- }
- }
-
- /*=========================================================================
- Returns true if the game square is white.
- =========================================================================*/
-
- #if 0
-
- //• Object size 44 bytes.
- Boolean SquareIsWhite(short c)
- {
- Boolean result;
-
- --c;
- result = bittst(0, c);
- if (bittst(3, c)) result = !result;
- return result;
- }
-
- #endif
-
- /*=========================================================================
- Returns true if the square is white.
- =========================================================================*/
-
- #if 0
-
- //• Object size 406 bytes - very slow!
- Boolean SquareIsWhite(short c)
- {
- if (c == 2 | c == 4 | c == 6 | c == 8 | c == 9 | c == 11 | c == 13 |
- c == 15 | c == 18 | c == 20 | c == 22 | c == 24 | c == 25 | c == 27 |
- c == 29 | c == 31 | c == 34 | c == 36 | c == 38 | c == 40 | c == 41 |
- c == 43 | c == 45 | c == 47 | c == 50 | c == 52 | c == 54 | c == 56 |
- c == 57 | c == 59 | c == 61 | c == 63) return true;
- return false;
- }
-
- #endif